﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="QLCauHoi.aspx.cs" Inherits="QuickGame.View.QLCauHoi" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxNavBar" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxTabControl" tagprefix="dx" %>

<%@ Register assembly="DevExpress.Web.v11.1.Linq, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Data.Linq" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
    // <![CDATA[
    function OnCountryChanged(cmbCountry) {
        ASPxGridView1.GetEditor("Loai");
    }
    // ]]> 
    </script>
<h2>
    Danh sách câu hỏi
    </h2>
    <br />
        <dx:ASPxLabel ID="txterror" runat="server" ForeColor="Red">
        </dx:ASPxLabel>
    <div style="height: 800px">
        
        <dx:ASPxGridView ID="grvCauHoi" runat="server" AutoGenerateColumns="False" 
            KeyFieldName="ID" 
            style="margin-left: 60px; margin-top: 54px" Width="806px" 
            oncelleditorinitialize="ASPxGridView1_CellEditorInitialize" 
            onrowupdating="ASPxGridView1_RowUpdating" 
            onstartrowediting="ASPxGridView1_StartRowEditing" 
            ondetailrowexpandedchanged="ASPxGridView1_DetailRowExpandedChanged" 
            onrowdeleting="ASPxGridView1_RowDeleting" 
            onrowinserting="ASPxGridView1_RowInserting" 
            onrowinserted="grvCauHoi_RowInserted" >
            <ClientSideEvents FocusedRowChanged="function(s, e) { OnCountryChanged(s); }" />
            <Columns>
                <dx:GridViewCommandColumn VisibleIndex="6" Width="100px">
                    <EditButton Visible="True" Text="Sửa" >
                    </EditButton>
                    <NewButton Visible="True" Text="Thêm">
                    </NewButton>
                    <DeleteButton Text="Xóa" Visible="True">
                    </DeleteButton>
                    <CancelButton Text="Hủy">
                    </CancelButton>
                    <UpdateButton Text="Lưu">
                    </UpdateButton>
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="ID" VisibleIndex="0" Visible="False">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Ma" VisibleIndex="1" Caption="Mã câu hỏi" 
                    Width="100px">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Ten" VisibleIndex="2" Caption="Nội dung">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataComboBoxColumn Caption="Loại" FieldName="Loai" VisibleIndex="3">
                    <PropertiesComboBox ValueType="System.Int32" TextFormatString="{1}" ValueField="Loai">
                    <Columns>
                        <dx:ListBoxColumn FieldName="Loai" Visible="False" />
                        <dx:ListBoxColumn Caption="Mã" FieldName="Ma" />
                        <dx:ListBoxColumn Caption="Loại" FieldName="Ten" />
                    </Columns>
                    </PropertiesComboBox>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataComboBoxColumn Caption="Cấp độ" FieldName="CapDo" 
                    ShowInCustomizationForm="True" VisibleIndex="4" Width="100px">
                    <PropertiesComboBox ValueType="System.String" TextFormatString="{1}" ValueField="CapDo">
                        <Columns>
                            <dx:ListBoxColumn FieldName="CapDo" Visible="False" />
                            <dx:ListBoxColumn Caption="Mã cấp độ" FieldName="Ma" />
                            <dx:ListBoxColumn Caption="Tên cấp độ" FieldName="Ten" />
                        </Columns>
                    </PropertiesComboBox>
                </dx:GridViewDataComboBoxColumn>
            </Columns>
            <SettingsBehavior AllowFocusedRow="True" />
            <SettingsPager NumericButtonCount="15" PageSize="15">
            </SettingsPager>
            <SettingsDetail ShowDetailRow="True"  />
            <Templates>
                <DetailRow>
                    <dx:ASPxGridView ID="GrvCauTraLoi" runat="server" AutoGenerateColumns="False" 
                        KeyFieldName="ID" 
                        onbeforeperformdataselect="ASPxGridView2_BeforePerformDataSelect" 
                        style="margin-left: 38px" Width="730px" 
                        onrowdeleting="GrvCauTraLoi_RowDeleting" 
                        onrowupdating="GrvCauTraLoi_RowUpdating" onload="GrvCauTraLoi_Load" 
                        onrowinserting="GrvCauTraLoi_RowInserting">
                        <Columns>
                            <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="5" 
                                Width="100px">
                                <NewButton Visible="True" Text="Thêm">
                                </NewButton>
                                <EditButton Visible="True" Text="Sửa">
                                </EditButton>
                                <DeleteButton Visible="True" Text="Xóa">
                                </DeleteButton>
                                <CancelButton Text="Hủy">
                                </CancelButton>
                                <UpdateButton Text="Lưu">
                                </UpdateButton>
                            </dx:GridViewCommandColumn>
                            <dx:GridViewDataTextColumn FieldName="ID" ReadOnly="True" VisibleIndex="0" 
                                Visible="False">
                                <EditFormSettings Visible="False" />
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn FieldName="Ma" VisibleIndex="1" 
                                Caption="Mã câu trả lời" Width="100px">
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn FieldName="Ten" VisibleIndex="2" Caption="Nội dung">
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn FieldName="IDCauHoi" VisibleIndex="3" 
                                Visible="False">
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataCheckColumn FieldName="TrangThai" VisibleIndex="4" 
                                Caption="Đúng/Sai" Width="100px">
                            </dx:GridViewDataCheckColumn>
                        </Columns>
                        <SettingsBehavior AllowFocusedRow="True" />
                        <Settings ShowFooter="True" />
                    </dx:ASPxGridView>
                </DetailRow>
            </Templates>
        </dx:ASPxGridView>
        
    </div>
</asp:Content>
